package com.xneure.ilog.views;

import org.eclipse.debug.core.IStreamListener;
import org.eclipse.debug.core.model.IStreamMonitor;

public class LogProcessor implements IStreamListener{
	private LogLevel type;
	private LogCallBack lcb;

	public LogProcessor(LogCallBack lcb,LogLevel type){
		this.type = type;
		this.lcb = lcb;
	}

	@Override
	public void streamAppended(String text,IStreamMonitor monitor){
		String substring = text.substring(20,30);
		LogLevel tmp = LogLevel.getLevel(substring);
		if(null == tmp){
			tmp = type;
		}
		lcb.call(text,tmp);
	}
}
